import 'package:flustars/flustars.dart';
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:tplib/utils/res_utils.dart';

/**
 * 状态按钮
 */
class CommStatusButton extends StatelessWidget{

  final VoidCallback? onPressed;
  final Color? bgColor;
  final String? defualtText;
  final Color? defualtTextColor;
  final double? defualtTextSize;
  final double? width;
  final double? height;
  final double? radius;
  final ShapeBorder? shape;

  CommStatusButton({
    Key? key,
    @required this.onPressed,
    this.bgColor,
    this.defualtTextColor,
    this.defualtTextSize,
    this.defualtText,
    this.width,
    this.height,
    this.radius,
    this.shape,
  });


  @override
  Widget build(BuildContext context) {
    LogUtil.e('CommStatusTempButton-->width=$width');
    return SizedBox(
      width: width??PxUtils.screenWidth,
      height:height?? PxUtils.px_44,
      child: RaisedButton(
        onPressed: (onPressed==null)?null:(()=>onPressed!()),
        shape: shape??RoundedRectangleBorder(
            borderRadius: BorderRadius.all(Radius.circular(radius??PxUtils.px_4))),

        elevation: PxUtils.px_0d5,
        highlightElevation: PxUtils.px_0d5,
        padding: EdgeInsets.only(),
        color: bgColor??ColorUtils.color_dcbe9b,
        child: Text(
          '${defualtText??''}',
          style: TextStyle(
              fontSize: defualtTextSize??PxUtils.px_14,
              color: defualtTextColor??ColorUtils.color_white
          ),
        ),
      ),
    );
  }
}